clear all
cd ..

use "Data/Processed Data/ACSdata_env_stdsize.dta" 
label variable env_ben_PC   "Env benefits per capita" 
label variable Median_HH_10k   "Income (10k)" 
label variable Urban_Indicator   "Urban" 
label variable share_pop_black   "Share Black" 
label variable share_pop_latino   "Share Hisp/Latinx"
label variable share_pop_asian   "Share Asian"
label variable share_pop_whitealone   "Share White"

eststo: reg env_ben_PC Median_HH_10k [aweight=Number_POP_x], vce(cluster CountyFIPS)
*eststo: reg env_ben_PC urban [aweight=Number_POP_x], vce(cluster CountyFIPS)
eststo: reg env_ben_PC Urban_Indicator [aweight=Number_POP_x], vce(cluster CountyFIPS)
eststo: reg env_ben_PC share_pop_black [aweight=Number_POP_x], vce(cluster CountyFIPS)
eststo: reg env_ben_PC share_pop_latino [aweight=Number_POP_x], vce(cluster CountyFIPS)
eststo: reg env_ben_PC share_pop_asian [aweight=Number_POP_x], vce(cluster CountyFIPS)
eststo: reg env_ben_PC share_pop_whitealone [aweight=Number_POP_x], vce(cluster CountyFIPS)

esttab using "tables/univariate_correlations_stdsize.tex", noconstant noobs nomtitles se label replace booktabs nonotes addnotes("Standard errors, clustered by county, in parentheses. Regressions weighted by population." "$^{*}$ $ p < 0.1$, $^{**}$ $ p < 0.05$, $^{***}$ $ p < 0.01$") star(* 0.1 ** 0.05 *** 0.01) ///
alignment(D{.}{.}{-1}) 

eststo clear

estpost sum env_ben_PC Median_HH_10k share_pop_black share_pop_latino share_pop_asian share_pop_whitealone Urban_Indicator [aweight=Number_POP_x]
esttab using "tables/sum_stats_stdsize.tex", replace label nonumber noobs nomtitle booktabs cell((mean(fmt(%9.3f) label(Mean)) sd(fmt(%9.3f) label(SD)) min(fmt(%9.3f) label(Min)) max(fmt(%9.3f) label(Max)))) addnotes("Tracts are weighted by population. Environmental benefits are \textit{received}.") ///
alignment(D{.}{.}{-1})

eststo clear

eststo: areg env_ben_PC Median_HH_10k share_pop_black [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)
eststo: areg env_ben_PC Median_HH_10k Urban_Indicator share_pop_black [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)

eststo: areg env_ben_PC Median_HH_10k share_pop_latino [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)
eststo: areg env_ben_PC Median_HH_10k Urban_Indicator  share_pop_latino [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)

eststo: areg env_ben_PC Median_HH_10k share_pop_asian [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)
eststo: areg env_ben_PC Median_HH_10k Urban_Indicator share_pop_asian[aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)

eststo: areg env_ben_PC Median_HH_10k share_pop_whitealone [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)
eststo: areg env_ben_PC Median_HH_10k Urban_Indicator share_pop_whitealone [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)

esttab using "tables/cond_corrs_1_stdsize.tex", b(3) se(3) noconstant noobs nomtitles se label replace booktabs nonotes addnotes("Standard errors, clustered by county, in parentheses. Regressions weighted by population." "Regressions control for census region FE." "$^{*}$ $ p < 0.1$, $^{**}$ $ p < 0.05$, $^{***}$ $ p < 0.01$") star(* 0.1 ** 0.05 *** 0.01) ///
alignment(D{.}{.}{-1}) 



eststo clear

eststo: areg env_ben_PC Median_HH_10k Urban_Indicator share_pop_black share_pop_latino share_pop_asian [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)
quietly estadd local fixed "Region", replace
eststo: areg env_ben_PC Median_HH_10k Urban_Indicator share_pop_black share_pop_latino share_pop_asian [aweight=Number_POP_x], absorb(stateFIPS) vce(cluster CountyFIPS)
quietly estadd local fixed "State", replace

eststo: areg env_ben_PC Median_HH_10k Urban_Indicator share_pop_whitealone [aweight=Number_POP_x], absorb(RegionName) vce(cluster CountyFIPS)
quietly estadd local fixed "Region", replace
eststo: areg env_ben_PC Median_HH_10k Urban_Indicator share_pop_whitealone [aweight=Number_POP_x], absorb(stateFIPS) vce(cluster CountyFIPS)
quietly estadd local fixed "State", replace

esttab using "tables/cond_corrs_2_stdsize.tex", b(3) se(3) noconstant noobs nomtitles label replace booktabs nonotes addnotes("Standard errors, clustered by county, in parentheses. Regressions weighted by population." "Regressions control for Census region or state fixed effects." "$^{*}$ $ p < 0.1$, $^{**}$ $ p < 0.05$, $^{***}$ $ p < 0.01$") star(* 0.1 ** 0.05 *** 0.01) s(fixed,label("FE")) ///
alignment(D{.}{.}{-1})
